'use strict';

const Service = require('egg').Service;

class listService extends Service {
    async getList(name,num,total) {
        if(name){                                  //SELECT * FROM list where name like '%${name}%'
            const res = await this.app.mysql.query(`select * from list where name like '%${name}%' `);
            return res
        }else if(num&&total){
            const res = await this.app.mysql.query(`select * from list limit ${(num-1)*5},${total}`);
            return {res,limit:25}
        }
    }
}

module.exports = listService;
